home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disk User Volume 4 #11 / Commodore_Disk_User_Vol.4_11_1991_-.d64 / clubhouse d-a (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  3KB  |  99 lines

  1. 1000 *=$c000
  2. 1010 !
  3. 1020 ! this code reads in track 18, sector 1
  4. 1030 ! and stores the 256 bytes at $cf00 onwards
  5. 1040 !
  6. 1050 ! written by jason finch 1991
  7. 1060 !
  8. 1070 !
  9. 1080 (NULL)lfs = $ffba ;_ set file details
  10. 1090 (NULL)nam = $ffbd ;_ set file name
  11. 1100 open = $ffc0 ;_ open logical file
  12. 1110 close = $ffc3 ;_ close logical file
  13. 1120 chkin = $ffc6 ;_ open channel for input
  14. 1130 chkout = $ffc9 ;_ open channel for output
  15. 1140 clrchn = $ffcc ;_ close input and output channels
  16. 1150 chrin = $ffcf ;_ input character from channel
  17. 1160 writecmd = $ab1e ;_ set-up command ready to send
  18. 1170 send = $abb5 ;_ send command (equiv. of print# statement)
  19. 1180 !
  20. 1190 !
  21. 1200 lda #$02;_ 2 char file name
  22. 1210 ldx #<i0;_ lo/hi for file name
  23. 1220 ldy #>i0
  24. 1230 jsr (NULL)nam;_ set the file name
  25. 1240 ;
  26. 1250 lda #$0f;_ open 15,
  27. 1260 ldx #$08;_         8,
  28. 1270 ldy #$0f;_           15
  29. 1280 jsr (NULL)lfs;_ set these parameters
  30. 1290 jsr open;_ open 15,8,15,"i0"
  31. 1300 ;
  32. 1310 bcs error;_ disk error
  33. 1320 ;
  34. 1330 lda #$01;_ 1 char file name
  35. 1340 ldx #<hash;_ lo/hi for file name
  36. 1350 ldy #>hash;
  37. 1360 jsr (NULL)nam;_ set the file name
  38. 1370 ;
  39. 1380 lda #$02;_ open 2,
  40. 1390 ldx #$08;_        8,
  41. 1400 ldy #$02;_          2
  42. 1410 jsr (NULL)lfs;_ set these parameters
  43. 1420 jsr open;_ open 2,8,2,"#"
  44. 1430 ;
  45. 1440 ldx #$0f
  46. 1450 jsr chkout;_ logical file 15 is an output channel
  47. 1460 ;
  48. 1470 lda #<command;_ lo/hi for start of command
  49. 1480 ldy #>command;
  50. 1490 jsr writecmd;_ get it ready to send
  51. 1500 jsr send;_ do equiv. of print# command in basic
  52. 1510 ;
  53. 1520 ldx #$02
  54. 1530 jsr chkin;_ prepare for input from logical file 2 (the buffer)
  55. 1540 ;
  56. 1550 ldy #$00;_ reset offset
  57. 1560 lp1 jsr chrin;_ get a character from the input channel (buffer)
  58. 1570 sta $cf00,y;_ store the character at $cf00-
  59. 1580 iny;_ increase offset
  60. 1590 bne lp1;_ if all 256 not done, go back for more
  61. 1600 ;
  62. 1610 lda #$02
  63. 1620 jsr close;_ close logical file 2
  64. 1630 ;
  65. 1640 lda #$0f
  66. 1650 jsr close;_ and close 15
  67. 1660 ;
  68. 1670 jsr clrchn;_ reset the i/o channels
  69. 1680 ;
  70. 1690 rts;_ back to basic with the right information stored, hopefully!
  71. 1700 !
  72. 1710 !
  73. 1720 !
  74. 1730 error ;
  75. 1740 ;
  76. 1750 lda #$0f
  77. 1760 jsr close;_ close 15
  78. 1770 ;
  79. 1780 jsr clrchn;_ reset i/o channels
  80. 1790 ;
  81. 1800 rts;_ return to basic - device not present
  82. 1810 !
  83. 1820 !
  84. 1830 ! the following are the different
  85. 1840 ! filenames and the command
  86. 1850 !
  87. 1860 ! copy exactly or this method
  88. 1870 ! will not work
  89. 1880 !
  90. 1890 !
  91. 1900 i0 byt "i0";_ this is sent to initialise the drive
  92. 1910 ;
  93. 1920 hash byt "#";_ the file name for the buffer
  94. 1930 ;
  95. 1940 command byt "u1:2 0 18 01",0;_ note the ',0' at the end - it is vital
  96. 1950 ;
  97. 1960 ! the '0' is a zero byte - not the ascii value for '0'
  98. 1970 ! it tells the computer where the end of the command lies
  99.